package com.itheima.mapper;

import com.itheima.pojo.vo.ReservationVo;
import com.itheima.pojo.Reservation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ReservationMapper {

    List<ReservationVo> list(String name, String username,Integer status);

    @Insert("insert into reservations(user_id, book_id, reservation_time,status ) values (#{userId},#{bookId},#{reservationTime},#{status})")
    void add(Reservation reservation);

    @Update("update reservations set status=#{status} where id=#{id}")
    void update(Integer id,Integer status);

    @Delete("delete from reservations where id=#{id}")
    void delete(Integer id);
}
